//
//  RootViewController.m
//  XMLParser
//
//  Created by honeyrr on 2017/10/17.
//  Copyright © 2017年 honeyrr. All rights reserved.
//

#import "RootViewController.h"
#import "NextViewController.h"

@interface RootViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tv;
@property(nonatomic, strong) NSArray *arr;
@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _arr = @[@"apple",@"hello",@"watch",@"miss",@"back",@"me"];
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.arr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = self.arr[indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NextViewController *view = [NextViewController new];
    view.string = self.arr[indexPath.row];
    [self.navigationController pushViewController:view animated:YES];
}

@end
